from tortoise import fields, models


class FoundLotTacticsStage(models.Model):
    id = fields.BigIntField(pk=True)
    record_status = fields.IntField(default=1, description="记录状态:1-有效;0-无效")
    create_time = fields.DatetimeField(auto_now_add=True, description="记录创建时间")
    update_time = fields.DatetimeField(auto_now=True, description="记录修改时间")
    lot_code = fields.CharField(max_length=50, default='', description="基金批次编码")
    seq = fields.IntField(default=1, description="楼层编码:平层为 0，上涨层 大于0")
    price_remark = fields.CharField(max_length=50, default='', description="价格区间备注，例如0.8-0.9")
    min_price = fields.DecimalField(max_digits=10, decimal_places=4, default=0.0000, description="楼层的最低单位基准净值（不含）")
    max_price = fields.DecimalField(max_digits=10, decimal_places=4, default=0.0000, description="楼层的最高单位基准净值（含）")
    in_base_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="楼层的单位基准金额，低于这个金额，需要加仓")
    in_onetime_buy_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="一次买入金额")
    out_earn_rate = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="收益率, 单笔买入批次，卖出时候需要达到的收益率")
    out_earn_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="收益金额, 单笔买入批次，卖出时候需要达到的收益金额")

    class Meta:
        table = "found_lot_tactics_stage"
        table_description = "策略明细表"
